package de.herberlin.webapp.image.action;

import java.util.LinkedList;
import java.util.List;

import de.herberlin.webapp.core.AbstractAction;
import de.herberlin.webapp.db.Service;
import de.herberlin.webapp.text.Page;

/**
 * Provides access to the preis pages
 */
public class GetPreisPagesAction extends AbstractAction {

	private static final long serialVersionUID = 1L;
	public static final String NAMES="Bewerbung,Portraits,Family,Baby,Firmen,Events,Hochzeiten";
	public static final String PREFIX="Preise";
	
	public List<Page> getPreisPages() {
		
		List<Page> result=new LinkedList<Page>();
		String[] names=NAMES.split(",");
		for (String s : names) {
			s=PREFIX+s;
			Page p=Service.getItem(Page.class, s);
			if (p==null) {
				logger.warn("Page not found: "+s);
			} else {
				result.add(p);
			}
		}
		return result;
	}
	
	
}
